package org.monitor.demo.controller;

import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;

import org.monitor.demo.pojo.NetworkInfo;
import org.monitor.demo.service.NetworkService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/network")
public class NetworkController {

	public NetworkController() {
		// TODO Auto-generated constructor stub
	}
	
	@RequestMapping("/info")
	public String info(Model model) {
		NetworkInfo info = (new NetworkService()).getNetwork();
		model.addAttribute("network", info);
//		OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
//		System.out.println(os.getClass().getName());
		
		return "network";
	}

}
